import java.util.Date;
import java.util.LinkedList;
import java.util.Scanner;


/**
 * @author 52845
 */
public class LinkListDemo {

    public static class Node{
        public int number;//商品编号

        public String name;//商品名称
        public double price;//商品价格

        public String describe;//商品种类


        public String amount;//商品个数

        public String date;//商品生产日期

       public Node(int number, String name, double price, String describe, String amount, String date){
           this.number = number;
           this.name = name;
           this.price=price;
           this.describe=describe;
           this.amount=amount;
           this.date=date;
       }

    }




    public static void main(String[] args)
    {
        LinkedList  list = new LinkedList();
        int n;//接收用户输入
        Scanner scanner = new Scanner(System.in);
        boolean loop = true;
        //输出一个菜单
        while(loop)
        {
            System.out.println("|-----欢迎来到超市仓库管理系统-----|");
            System.out.println("1、添加商品信息");
            System.out.println("2、根据编号将物品插入到指定位置");
            System.out.println("3、显示所有商品的信息");
            System.out.println("4、删除指定商品信息");
            System.out.println("5、修改指定商品信息");
            System.out.println("6、查询当前链表中有多少食品");
            System.out.println("7、查询指定生产日期的物品个数，并输出查询的商品信息");
            System.out.println("8、查询即将过期的商品");
            System.out.println("9、退出程序");
            System.out.println("请输入你的选择:");
            n = scanner.nextInt();
            switch(n)
            {
                case 1:
                    System.out.println("请输入物品信息");
                    GoodsLinkNode s1=new GoodsLinkNode();
                    s1.setInfo();
                    list.add(s1);
                    break;
                case 2:
                    System.out.println("请输入物品信息");
                    GoodsLinkNode s2=new GoodsLinkNode( );
                    s2.setInfo();
                    list.addByNumber(s2);
                    break;
                case 3:
                    list.showlist();
                    list.InMemory();
                    break;
                case 4:
                    System.out.print("请输入你要删除的物品编号");
                    int snumber = scanner.nextInt();
                    list.delete(snumber);
                    System.out.println("删除成功");
                    break;
                case 5:
                    System.out.println("请输入你要修改的物品的编号：");
                    int snu = scanner.nextInt();
                    System.out.println("请输入修改后的名称为：");
                    String  sna = scanner.next();
                    System.out.println("请输入修改后的价格为：");
                    double spr = scanner.nextInt();
                    System.out.println("请输入修改后的种类为：");
                    String sde = scanner.next();
                    System.out.println("请输入修改后的数量为：");
                    String sdp = scanner.next();
                    System.out.println("请输入修改后的生产日期为：");
                    String sda = scanner.next();
                    GoodsLinkNode s3 = new GoodsLinkNode(snu,sna,spr,sde,sdp,sda);
                    list.update(s3);
                    System.out.println("修改成功");
                    break;
                case 6:
                    int num = list.len();
                    System.out.println("当前链表中共记录了"+num+"个物品信息");
                    break;
                case 7:
                    System.out.println("请输入你要查询的物品分类:");
                    String sde2 = scanner.next();
                    list.getbyDate(sde2);
                    break;
                case 8:
                    String dead = list.ByDate();
                    System.out.println("出库预警：");
                    break;
                case 9:
                    scanner.close();
                    loop = false;
                    break;
                default:


            }
        }

    }


}